#ifndef __CE_MATH_PLANE_H__
#define __CE_MATH_PLANE_H_

#include <math/vector.h>

/**
 * \addtogroup math
 * @{
 */

/**
 * @brief Mathematical representation of a plane
 */
class cePlane
{
private:
  float _x;
  float _y;
  float _z;
  float _d;

public:
  inline cePlane (float x, float y, float z, float d) : _x(x), _y(y), _z(z), _d(d) {}
  cePlane (const ceVector3f& p0, const ceVector3f& p1, const ceVector3f& v1);
  cePlane (const ceVector3f& n, const ceVector3f& p);


  /**
   * \brief Returns the location of \a v relative to this plane.
   *
   * \return 0 if \a v is on the plane, < 0  if \a v is below the plane, > 0 if \a v is above the plane.
   */
  float Location (const ceVector3f& v) const
  {
    return (float)(v.x * _x + v.y * _y + v.z * _z + _d);
  }

};

/** @} */

#endif /* ! __CE_MATH_PLANE_H__ */

